package com.metrics.objects;

import static com.metrics.utils.FormatNumberUtil.*;

public class DeveloperContribution implements Comparable<DeveloperContribution> {

	private static final String SEPARATOR = "%%";

	private String developer;

	private Double contributionElements;

	private Double contributionComplexity;

	public DeveloperContribution(String developer, Double contributionElements, Double contributionComplexity) {
		this.developer = developer;
		this.contributionElements = contributionElements;
		this.contributionComplexity = contributionComplexity;
	}

	public String getDeveloper() {
		return developer;
	}

	public Double getContributionElements() {
		return contributionElements;
	}

	public Double getContributionComplexity() {
		return contributionComplexity;
	}

	public String getText() {
		String conElements = formatTextToFourDecimals(contributionElements);
		String conComplexity = formatTextToFourDecimals(contributionComplexity);
		return developer + SEPARATOR + conElements + SEPARATOR + conComplexity;
	}

	@Override
	public int compareTo(DeveloperContribution other) {
		Double contribution1 = this.getContributionElements();
		Double contribution2 = other.getContributionElements();

		return contribution2.compareTo(contribution1);
	}

}